var cordovaExec = function(plugin, action, parameters, callback) {
	//cordova.exec(successCallback, errorCallback, plugin, action, parameters);
	cordova.exec(
			function(data) {
				if (callback !== undefined) {
					alert("data: "+data);
					callback();
				}
			}, function(err) {
				alert("失败! ");
			}, plugin, action, parameters === null || parameters === undefined ? [] : parameters);
};

var connXmppServer=function(username,password){
	//alert("connXmppServer() invoked.");
	cordovaExec("ApnPlugin","connXmppServer",[{"username":username,"password":password}],successCallback);	
}

var successCallback=function(){
	//alert("连接服务器成功！");
}

var errorCallback=function(){
	alert("Connect server failed!");
}

//刷新网页
var refreshMessage=function(message){
	//alert("收到刷新信息：-->"+message);
	var span=document.getElementById("messageInfo");
	var text=span.innerHTML;
	span.innerHTML=text+"<br/>"+message;
}
